import {defHttp} from '/@/utils/http/axios';

enum Api {
  LIST_URL = '/lemon-payment/order/refund/page',
  DETAIL_URL = '/lemon-payment/order/refund/detail',
  SAVE_URL = '/lemon-payment/order/refund/create',
  UPDATE_URL = '/lemon-payment/order/refund/update',
}

/**
 * 退款订单列表
 * @param params
 */
export const pageList = (params) => defHttp.get({url: Api.LIST_URL, params});

/**
 * 退款订单详情
 * @param id
 */
export const getById = (id) => {
  return defHttp.get({url: Api.DETAIL_URL + `/${id}`});
};

/**
 * 保存或者更新退款订单
 * @param params
 * @param isUpdate
 */
export const saveOrUpdate = (params, isUpdate) => {
  const url = isUpdate ? Api.UPDATE_URL : Api.SAVE_URL;
  return defHttp.post({url: url, params});
};
